﻿//https://leetcode.cn/problems/check-permutation-lcci/

class Solution {
public:
    bool CheckPermutation(string s1, string s2)
    {
        if (s1.size() != s2.size()) return false;
        int hash[26] = { 0 };
        for (auto& e : s1)
        {
            hash[e - 'a']++;
        }
        for (auto& e : s2)
        {
            hash[e - 'a']--;
            if (hash[e - 'a'] < 0) return false;
        }
        return true;
    }
};
